package com.xinke.module.system.mapper.social;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.social.SocialUserDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.social.*;

/**
 * 社交用户 Mapper
 *
 * @author yzx
 */
@Mapper
public interface SocialUserMapper extends BaseMapperExt<SocialUserDO> {

    default PageResult<SocialUserDO> selectPage(SocialUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<SocialUserDO>()
                .eqIfPresent(SocialUserDO::getSocialType, reqVO.getSocialType())
                .eqIfPresent(SocialUserDO::getSocialOpenid, reqVO.getSocialOpenid())
                .eqIfPresent(SocialUserDO::getSocialToken, reqVO.getSocialToken())
                .eqIfPresent(SocialUserDO::getRawTokenInfo, reqVO.getRawTokenInfo())
                .likeIfPresent(SocialUserDO::getUserNickName, reqVO.getUserNickName())
                .eqIfPresent(SocialUserDO::getUserAvatar, reqVO.getUserAvatar())
                .eqIfPresent(SocialUserDO::getRawUserInfo, reqVO.getRawUserInfo())
                .eqIfPresent(SocialUserDO::getAuthCode, reqVO.getAuthCode())
                .eqIfPresent(SocialUserDO::getAuthState, reqVO.getAuthState())
                .orderByDesc(SocialUserDO::getSocialUserId));
    }

}